﻿namespace TestTool.GUI.Data
{
    using System;
    using System.IO;

    public class RequestFile
    {
        private string _content;
        private string _fileName;
        private string _path;

        public RequestFile(FileInfo fileInfo)
        {
            this._path = fileInfo.FullName;
            this._fileName = fileInfo.Name;
        }

        private void LoadContent()
        {
            FileStream stream = File.OpenRead(this._path);
            TextReader reader = new StreamReader(stream);
            this._content = reader.ReadToEnd();
            reader.Close();
            stream.Close();
            stream.Dispose();
        }

        public string Content
        {
            get
            {
                if (string.IsNullOrEmpty(this._content))
                {
                    this.LoadContent();
                }
                return this._content;
            }
        }

        public string FileName
        {
            get
            {
                return this._fileName;
            }
        }

        public string Path
        {
            get
            {
                return this._path;
            }
        }
    }
}

